package com.wuditp.smile.core.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

/**
 * 业务领域模型对象基类
 * 
 * @author kevin.tao
 * 
 */
@MappedSuperclass
public abstract class DomainBusiness extends DomainInstance implements UnDeletable, Versionable {

	private static final long serialVersionUID = 1L;

	@Column(name = "entity_desc")
	protected String description;

	@Column(name = "is_deleted")
	protected Boolean isDeleted = Boolean.FALSE;

	@Column(name = "entity_create_date")
	protected Date createDate;

	@Column(name = "entity_version")
	protected Integer version;

	@Override
	public boolean isDeleted() {
		return null == this.isDeleted ? false : this.isDeleted.booleanValue();
	}

	@Override
	public void markedAsAvailable() {
		this.isDeleted = Boolean.TRUE;
	}

	@Override
	public void markedAsDeleted() {
		this.isDeleted = Boolean.FALSE;
	}

	@Override
	public Integer getVersion() {
		return this.version;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Boolean getIsDeleted() {
		return isDeleted;
	}

	public void setIsDeleted(Boolean isDeleted) {
		this.isDeleted = isDeleted;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

}
